# 打开百度，输入周杰伦，滑动底部，下一页，后退，前进
import time

from selenium import webdriver
from selenium.webdriver.common.by import By

# 将chromedriver配置到path中
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
element = driver.find_element(By.ID, "kw")
element.send_keys("周杰伦")
driver.find_element(By.ID,"su").click()
time.sleep(2)
js_bottom="document.documentElement.scrollTop=100000"
driver.execute_script(js_bottom)
time.sleep(2)
next = driver.find_element(By.XPATH, "//a[@class='n']")
next.click()
time.sleep(2)
driver.back()
time.sleep(2)
driver.forward()

time.sleep(50)




